//
//  XZStudentContactCell.m
//  优学荟管理系统
//
//  Created by edz on 2018/1/10.
//  Copyright © 2018年 星道三好. All rights reserved.
//

#import "XZStudentContactCell.h"

@implementation XZStudentContactCell {
    
    __weak IBOutlet UIButton *iconImage;
    __weak IBOutlet UILabel *name;
    __weak IBOutlet UILabel *phoneNum;
    __weak IBOutlet UIButton *moreBtn;
    __weak IBOutlet UIButton *smalIcon;
}

- (void)awakeFromNib {
    [super awakeFromNib];
 
    [moreBtn SG_imagePositionStyle:(SGImagePositionStyleRight) spacing:10];
}

- (void)setModel:(ZYstudentDetailModel *)model {
    _model = model;
    
    smalIcon.hidden = [model.orderId isEqualToNumber:@0] ? NO : YES;
    
    BOOL isUp = [NSString isBlankString:[model.owner valueForKey:@"petName"]];
    
    if (isUp) {
        name.text = @"";
    } else {
        name.text = [model.owner valueForKey:@"petName"];
    }
    phoneNum.text = [NSString stringWithFormat:@"%@",[model.owner valueForKey:@"phone"]];
    [iconImage setTitle:[name.text substringToIndex:1] forState:UIControlStateNormal];
}

#pragma mark - 查看更多
- (IBAction)seeMore:(UIButton *)sender {
    if (_CallBack) {
        _CallBack(self.model.uid);
    }
}

- (IBAction)callPhone:(UIButton *)sender {
    if (_CallPhone) {
        _CallPhone(self.model.owner[@"phone"]);
    }
}

- (IBAction)gantanhao:(UIButton *)sender {
    /**
     “暂无缴费有评价：指的是学生导入到教学管理系统的第一个月内，老师对学生进行评价，家长查看这条评价。平台给与补贴。”
     **/
    
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"“暂无缴费有评价：指的是学生导入到教学管理系统的第一个月内，老师对学生进行评价，家长查看这条评价。平台给与补贴。”" preferredStyle:(UIAlertControllerStyleAlert)];
    UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleCancel) handler:nil];
    [alert addAction:action];
    [[[AppDelegate shareAppDelegate] getCurrentUIVC] presentViewController:alert animated:YES completion:nil];
}


@end
